package com.jwthhealth_pub.old.physicalfitness.view;

import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;

import com.jwthhealth_pub.R;
import com.jwthhealth_pub.common.view.TitleLayout;
import com.jwthhealth_pub.old.common.Constant;
import com.jwthhealth_pub.old.physicalfitness.view.adapter.phesicalFitnessAnswerAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/12/20.
 */
public class PhysicalFitnessAnswerActivity extends Activity {
    @BindView(R.id.rv_physicalfitness)
    RecyclerView rvPhysicalfitness;
    @BindView(R.id.btn_retext)
    Button btnRetext;
    @BindView(R.id.sign_topbar)
    TitleLayout signTopbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_physicalanswer);
        ButterKnife.bind(this);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        }

        initClick();
        initRecycleView();
    }

    private void initRecycleView() {
        rvPhysicalfitness.setLayoutManager(new LinearLayoutManager(this));
        rvPhysicalfitness.setAdapter(new phesicalFitnessAnswerAdapter(this, getIntent().getBooleanExtra(Constant.PHYSICAL_ANSERT, false)));

        boolean isRetest = getIntent().getBooleanExtra(Constant.ISRETEXT, false);
        if (isRetest) {
            btnRetext.setVisibility(View.VISIBLE);
        }
    }

    private void initClick() {
        signTopbar.setOnTitleLayoutListener(new TitleLayout.TitleLayoutListener() {
            @Override
            public void leftclick() {
                finish();
            }

            @Override
            public void leftTextClick() {

            }

            @Override
            public void rightclick() {

            }

            @Override
            public void rightTextClick() {

            }
        });
    }

    @OnClick(R.id.btn_retext)
    public void onClick() {
        startActivity(new Intent(this, PhysicalFitnessActivity.class));
        finish();
    }
}
